import { randomUUIDString, messages } from "share/common"
import { nodeTypes, approverTypes } from 'components/simple-flow/node-list'
import constants from "share/constants"
import { message } from 'antd'
import workflowUtil from 'containers/setting/new-workflow/utils'
import workflowService from 'containers/setting/workflow/workflow.service'

export let nodeTypeName = {
  1000: messages('setting.key1939')/*开始*/,//开始
  1005: messages('setting.key1252')/*结束*/,//结束
  1008: messages('setting.key1940')/*分叉*/,//分叉
  1009: messages('setting.key1941')/*合并*/,//合并
  1010: messages('setting.key1330')/*条件*/,//条件
  1001: messages('setting.key1248')/*审批*/,//审批
  1003: messages('setting.key1327')/*机器人*/,//机器人
  1002: messages('setting.key1272')/*知会*/,//知会
  1004: messages('setting.key1251')/*打印*/,//打印
  1007: messages('setting.key1729')/*信用付款*///信用
};

export let chnNumChar = [
  messages('setting.key1291')/*一级*/,
  messages('setting.key1292')/*二级*/,
  messages('setting.key1293')/*三级*/,
  messages('setting.key1294')/*四级*/,
  messages('setting.key1295')/*五级*/,
  messages('setting.key1296')/*六级*/,
  messages('setting.key1297')/*七级*/,
  messages('setting.key1298')/*八级*/,
  messages('setting.key1299')/*九级*/,
  messages('setting.key1300')/*十级*/];

export let approvalAndDepLevel = [  //审批级别 部门层级
  { id: 1, name: messages('setting.key1309'/*本级*/), depLevel: messages('setting.key1291'/*一级*/) },
  { id: 2, name: messages('setting.key1310'/*第二级*/), depLevel: messages('setting.key1292'/*二级*/) },
  { id: 3, name: messages('setting.key1311'/*第三级*/), depLevel: messages('setting.key1293'/*三级*/) },
  { id: 4, name: messages('setting.key1312'/*第四级*/), depLevel: messages('setting.key1294'/*四级*/) },
  { id: 5, name: messages('setting.key1313'/*第五级*/), depLevel: messages('setting.key1295'/*五级*/) },
  { id: 6, name: messages('setting.key1314'/*第六级*/), depLevel: messages('setting.key1296'/*六级*/) },
  { id: 7, name: messages('setting.key1315'/*第七级*/), depLevel: messages('setting.key1297'/*七级*/) },
  { id: 8, name: messages('setting.key1316'/*第八级*/), depLevel: messages('setting.key1298'/*八级*/) },
  { id: 9, name: messages('setting.key1317'/*第九级*/), depLevel: messages('setting.key1299'/*九级*/) },
  { id: 10, name: messages('setting.key1318'/*第十级*/), depLevel: messages('setting.key1300'/*十级*/) }
];

export let itineraryTypes = [
  { id: 1001, name: messages('setting.key1855')/*TMC机票*/ },
  { id: 1002, name: messages('setting.key717')/*火车*/ },
  { id: 1003, name: messages('mcd.tmc.hotel'/*TMC酒店*/) },
  { id: 1012, name: messages('mcd.cus.airline'/*非TMC机票*/) },
  { id: 1011, name: messages('mcd.cus.hotel'/*非TMC酒店*/) },
  { id: 1013, name: messages('mcd.cus.city.traffic'/*市内交通*/) },
  { id: 1014, name: messages('mcd.cus.amphibious'/*水陆客运*/) },
  { id: 1008, name: messages('setting.key2229')/*用车*/ },
  { id: 1010, name: messages('setting.key2228')/*用餐*/ },
  { id: 1006, name: messages('setting.key1856')/*差补*/ },
]

export default {
//前端随机生成uuid
  getRandomUUID(){
    return (randomUUIDString() + randomUUIDString() + "-" + randomUUIDString() + "-" + randomUUIDString() + "-"
    + randomUUIDString() + "-" + randomUUIDString() + randomUUIDString() + randomUUIDString())
  },
  modifyFlowData(data){
    let temRuleApprovalRoutes = [];
    let ruleApprovalNodes = []
    //遍历路由数据
    data.ruleApprovalRoutes.forEach((item, index) => {
      let temNodeFrom = {}, temNodeTo = {}, route = {};
      item['from'] = item.sourceNodeOID || item.from;
      item['to'] = item.targetNodeOID || item.to;
      //有条件的塞进节点数组变成条件节点
      if (item.ruleConditionDTO || (item.remark && item.priority)) {
        item.type = nodeTypes.CONDITION;
        item.ruleApprovalNodeOID = item.ruleApprovalRouteOID;
        item.remark = item.remark || messages('setting.key1330')/*条件*/;
        item.ruleConditionDTO = item.ruleConditionDTO || {
            ruleConditionDTOList: [],
            symbol: 9020,
            type: 2,
          };
        item.viewMap = {
          copySource: 'false',
          isCanPaste: 'false',
          errorToast: 'false',
        };
        temNodeFrom = {
          from: item.from,
          // type: nodeTypes.CONDITION,
          ruleApprovalNodeOID: item.ruleApprovalRouteOID,
          to: item.ruleApprovalRouteOID
        };
        temNodeTo = {
          from: item.ruleApprovalRouteOID,
          // type: nodeTypes.CONDITION,
          ruleApprovalNodeOID: item.ruleApprovalRouteOID,
          to: item.to
        };
        ruleApprovalNodes.push(item);
        //路由{条件}转换成{条件}{条件}
        temRuleApprovalRoutes.push(temNodeFrom);
        temRuleApprovalRoutes.push(temNodeTo);
      } else {
        delete item.ruleApprovalRouteOID;
        route = {
          from: item.from,
          to: item.to
        };
        //删除路由中的条件路由
        temRuleApprovalRoutes.push(route)
      }
    });
    data.ruleApprovalNodes.map(item => {
      //塞入对应的开闭节点
      if (item.type === nodeTypes.CLOSE || item.type === nodeTypes.OPEN) {
        item.route = item.closeNodeOID;
      }
      ruleApprovalNodes.push(item);
    });
    data.ruleApprovalRoutes = temRuleApprovalRoutes;
    data.ruleApprovalNodes = ruleApprovalNodes;
    return data;
  },


  modifyFlowDataToSave(data){
    let workflowApprover = {
      '1100': [],
      '2200': [],
      '6001': [],
      '6002': [],
      '6004': [],
      '6100': [],
      '6003': [],
      '6600': [],
      '3300': [],
      '6005': [],
      '6006': [],
      '7100': [],
    };
    let ruleApprovalNodes = [];//节点数据
    let conditionNodesIDS = [];//条件节点OID数据
    let conditionNodes = [];//条件节点数据
    let temRuleApprovalRoutes = [];//节点路由
    let copyData = JSON.parse(JSON.stringify(data))
    //节点中首先删除条件节点
    data.ruleApprovalNodes.map(item => {
      delete item.from;
      delete item.to;
      if (item.type !== nodeTypes.CONDITION) {
        if (item.type === nodeTypes.CLOSE || item.type === nodeTypes.OPEN) {
          item.closeNodeOID = item.route;
        }
        if (item.type === nodeTypes.APPROVE || item.type === nodeTypes.KNOWN) {
          if (item.nodeApproverType === 1) {
            item.ruleBranchApprover['1004'] = [];
            item.ruleBranchApprover['7100'] = [];
          }
          if (item.nodeApproverType === 3) {
            item.ruleBranchApprover = {
              ...workflowApprover,
              7100 :item.ruleBranchApprover['7100']
            }
          }
          if (item.nodeApproverType === 2) {
            item.ruleBranchApprover = {
              ...workflowApprover,
              1004: item.ruleBranchApprover['1004']
            }
          }
        }
        ruleApprovalNodes.push(item)
      } else {
        conditionNodes.push(item);
        conditionNodesIDS.push(item.ruleApprovalNodeOID);
      }
    });
    let temConditionArr = []
    copyData.ruleApprovalRoutes.map((item, index) => {
      //条件节点全部分数组处理
      if (conditionNodesIDS.indexOf(item.to) !== -1 || conditionNodesIDS.indexOf(item.from) !== -1) {
        if (conditionNodesIDS.indexOf(item.to) !== -1) {
          item.ruleApprovalNodeOID = item.to;
          data.ruleApprovalRoutes.splice(index, 1);
          temConditionArr.push(Object.assign(item, conditionNodes[conditionNodesIDS.indexOf(item.to)]))
        } else if (conditionNodesIDS.indexOf(item.from) !== -1) {
          item.ruleApprovalNodeOID = item.from;
          data.ruleApprovalRoutes.splice(index, 1);
          temConditionArr.push(Object.assign(item, conditionNodes[conditionNodesIDS.indexOf(item.from)]))
        }
      } else {
        item.sourceNodeOID = item.from;
        item.targetNodeOID = item.to;
        temRuleApprovalRoutes.push(item);
      }
    });
    let showCondition = {};
    conditionNodesIDS.map(id => {
      showCondition[id] = {};
      temConditionArr.map(item => {
        if (id === item.ruleApprovalNodeOID) {
          showCondition[id].remark = item.remark;
          showCondition[id].priority = item.priority;
          showCondition[id].ruleConditionDTO = item.ruleConditionDTO;
          showCondition[id].type = item.type;
          showCondition[id].ruleApprovalChainOID = item.ruleApprovalChainOID;
          showCondition[id].ruleApprovalRouteOID = item.ruleApprovalNodeOID;
          if (item.from !== id) {
            showCondition[id].sourceNodeOID = item.from;
          }
          if (item.to !== id) {
            showCondition[id].targetNodeOID = item.to;
          }

        }
      })
    });
    conditionNodesIDS.map(id => {
      temRuleApprovalRoutes.push(
        showCondition[id])
    });
    data.ruleApprovalNodes = ruleApprovalNodes;
    data.ruleApprovalRoutes = temRuleApprovalRoutes;
    return data
  },

  //获取默认数据
  getNodeMessage(nodes, list = null){
    let workflowApprover = {
      '1100': [],
      '2200': [],
      '6001': [],
      '6002': [],
      '6004': [],
      '6100': [],
      '6003': [],
      '1004': [],
      '6600': [],
      '6500': [],
      '3300': [],
      '6005': [],
      '6006': [],
    };
    nodes.map((item, index) => {
        if (!item.ruleApprovalChainOID) {
          let params = {
            approvalActions: "8001",//节点类型
            approvalIsPass: false,
            "approvalOvertimeDay": "0-0",//审批超时
            "code": null,
            "comments": null,
            "companyOID": null,
            "containsSelfApprovalSkip": null,
            "countersignRule": 3001,//会签规则  3001 所有人审批通过 3002任意人审批通过
            "droolsBatchCodeRuleResultMap": {},
            "droolsRuleDetailResultOIDList": [],
            "nullableRule": 2001,//节点为空时 2001跳过 2002不跳过
            "repeatRule": 4001,
            "ruleApprovalChainOID": workflowUtil.getRandomUUID(),
            "ruleApproverMap": null,
            "ruleBranchApprover": workflowApprover,
            "sequence": 1460,
            "status": 1,
            "editable": null,
            "entityOID": null,
            "invoiceAllowUpdateType": 0,
            "isPrint": null,
            "notifyInfo": null,
            "nodeApproverType": 1,
            "viewMap":{
              copySource: 'false',
              isCanPaste: 'false',
              errorToast: 'false',
            }
          };
          if (item.type === nodeTypes.KNOWN) {
            params.notifyInfo = {
              "isApp": true,
              "isWeChat": true,
              "isEmail": true,
              "isWeb": true,
              "isName": true,
              "title": "",
              "isMoney": true,
              "isReason": true,
              "content": ""
            }
            params.approverType = '100';//审批类型 100普通审批 200连续多级 300外部接口
          } else if (item.type === nodeTypes.APPROVE) {
            params.selfApprovalRule = 5003;// 包含申请人 5002跳过 5003不跳过
            params.approverType = '100';//审批类型
            //不做特殊处理
          } else if (item.type === 1007) {
            params.ruleBranchApprover = {
              ...workflowApprover,
              '7700': [{
                "approverEntityOID": "00000000-0000-0000-0000-000000000002",
                "approverType": 1007,
                "level": 1,
                "name": "信用付款",
                "remark": "信用付款",
                "ruleApprovalNodeOID": item.ruleApprovalNodeOID,
                "ruleApproverOID": workflowUtil.getRandomUUID(),
                "status": 1
              }],
            }
          } else if (item.type === 1003) {
            params.ruleBranchApprover =
              {
                ...workflowApprover,
                '7700': [{
                  approverEntityOID: "00000000-0000-0000-0000-000000000000",
                  approverType: 1003,
                  level: 1,
                  ruleApprovalNodeOID: item.ruleApprovalNodeOID,
                  ruleApproverOID: workflowUtil.getRandomUUID(),
                  status: 1
                }],
              }
          } else if (item.type === nodeTypes.AUDIT) {
            params.countersignRule = 3002;
            //页面不显示
            params.nullableRule = null;
            params.selfApprovalRule = null
            params.invoiceAllowUpdateType = null;
            //页面不显示
          } else if (item.type === nodeTypes.CONDITION) {
            params.ruleConditionDTO = {
              ruleConditionDTOList: [],
              symbol :9020,
              type: 2,
            };
          } else if(item.type === nodeTypes.START || item.type === nodeTypes.END){
            params.ruleBranchApprover = null;
          }
          list && !!list.length && list.map(type => {
            if (type === item.type) {
              item.isCanPaste = true;
            }
          });
          Object.assign(item, params);
        }
      }
    )
    return nodes
  },
  //判断审批人是否为空
  //true 有
  //false 没有
  isHaveApporver(appovers){
    let flag = false;
    if (appovers) {
      approverTypes.map(type => {
        if (!!(appovers[type] || []).length) {
          flag = true
        }
      });
    } else {
      flag = false
    }
    return flag
  },
  //条件数组分类
  getSymbolsTypeList (symbolsType) {
    let ruleList = {
      'moreThanRuleList': [],
      'haveRuleList': [],
      'lessThanAndEqualRuleList': [],
      'containRuleList': [],
      'inRuleList': [],
      'booleanRuleList': [],
    };
    symbolsType.map(item => {
      if (item.key === 9001 || item.key === 9002) {
        ruleList['moreThanRuleList'].push({
          name: constants.getTextByValue(item.key, 'symbolFilter'),
          key: item.key + ''
        })
      }
      if (item.key === 9008 || item.key === 9007 || item.key === 9006 || item.key === 9005) {
        ruleList['haveRuleList'].push({
          name: constants.getTextByValue(item.key, 'symbolFilter'),
          key: item.key + ''
        })
      }
      if (item.key === 9003 || item.key === 9004 || item.key === 9005) {
        ruleList['lessThanAndEqualRuleList'].push({
          name: constants.getTextByValue(item.key, 'symbolFilter'),
          key: item.key + ''
        })
      }
      if (item.key === 9007 || item.key === 9008) {
        ruleList['containRuleList'].push({
          name: constants.getTextByValue(item.key, 'symbolFilter'),
          key: item.key + ''
        })
      }
      if (item.key === 9009 || item.key === 9010 || item.key === 9015 || item.key === 9016) {
        ruleList['inRuleList'].push({
          name: constants.getTextByValue(item.key, 'symbolFilter'),
          key: item.key + ''
        })
      }
      if (item.key === 9012 || item.key === 9013) {
        ruleList['booleanRuleList'].push({
          name: constants.getTextByValue(item.key, 'symbolFilter'),
          key: item.key + ''
        })
      }
    });
    //组合数字类型 无放在最后
    ruleList['moreThanRuleList'].push({
      name: messages('setting.key1301'/*无*/), key: '0'
    });
    ruleList['lessThanAndEqualRuleList'].push({
      name: messages('setting.key1301'/*无*/), key: '0'
    });
    return ruleList;
  },

  getIndexArr  (conditionOID, node) {
    function findId(conditionOID, list, index) {
      for(let i = 0; i < list.length; i++) {
        let nowItem = list[i];
        if (nowItem.conditionOID === conditionOID) {
          index.push(i + 1);
          return index;
        }
        if (nowItem.ruleConditionDTOList) {
          let temp = [].concat(index);
          temp.push(i + 1);
          let result = findId(conditionOID, nowItem.ruleConditionDTOList, temp);
          if (result) {
            return result;
          }
        }
      }
    }

    let indexes = findId(conditionOID, (node.ruleConditionDTO || { ruleConditionDTOList: [] }).ruleConditionDTOList, []);
    return indexes || [];
  },

  //  valuedetail转换
  getStringJsonToObject (value){
    if (value) {
      if (typeof value === 'string') {
        return JSON.parse(value);
      } else {
        return value;
      }
    } else {
      return {}
    }
  },

  handleVerify (data, node = null, showMessage = false) {
    let saveAble = true, mess = '';
    for(let i = 0; i < data.ruleConditionDTOList.length; i++) {
      let item = data.ruleConditionDTOList[i];
      let fieldTypeId;
      switch(workflowService.checkNewRemarkType(item.remark)) {
        case 'text':
          fieldTypeId = 101;
          break;
        case 'long':
          fieldTypeId = 102;
          break;
        case 'double':
          fieldTypeId = 104;
          break;
        case 'date':
          fieldTypeId = 105;
          break;
        case 'custList':
        case 'selector':
          fieldTypeId = 106;
          break;
        case 'boolean':
          fieldTypeId = 108;
          break;
        case 'combo':
          fieldTypeId = 104;
          break;
        default:
          fieldTypeId = null;
      }
      item.fieldTypeId = fieldTypeId;
      item.valueDetail = workflowUtil.getStringJsonToObject(item.valueDetail);
      let indexSq = workflowUtil.getIndexArr(item.conditionOID, node).join('.');
      if (saveAble && !item.valueDetail && item.type === 1) {
        //条件没有添加
        showMessage && message.error(messages('setting.key1942', {
          arg1: indexSq,
          arg2: item.name
        })/*请添加条件{arg1}:{arg2}*/);
        saveAble = false;
        mess = messages('setting.key1942', {
          arg1: indexSq,
          arg2: item.name
        });
        break;
      } else if (saveAble && item.type === 2) {
        if (saveAble && (!item.ruleConditionDTOList || item.ruleConditionDTOList.length === 0)) {
          showMessage && message.error(messages('setting.key1943', { arg1: indexSq })/*请给条件组{arg1}:添加条件*/);
          saveAble = false;
          mess = messages('setting.key1943', { arg1: indexSq })/*请给条件组{arg1}:添加条件*/;
          break;
        } else {
          saveAble = (workflowUtil.handleVerify(item, node, showMessage)).isValid
        }
      } else if (saveAble && item.valueDetail) {
        let type = workflowService.checkNewRemarkType(item.remark);
        let isVefityValus = ['selector', 'custList'];
        if (saveAble && isVefityValus.indexOf(type) !== -1) {
          let isShowAddBtn = !(String(item.symbol) === '9015' || String(item.symbol) === '9016');
          if (saveAble && isShowAddBtn && (!item.valueDetail ||
            (!item.valueDetail.valueOIDs || item.valueDetail.valueOIDs.length === 0))) {
            showMessage && message.error(messages('setting.key1944', {
              arg1: indexSq,
              arg2: item.name
            })/*请选择条件{arg1}:{arg2}的条件值*/);
            saveAble = false;
            mess = messages('setting.key1944', {
              arg1: indexSq,
              arg2: item.name
            });
          }
        }
        if (saveAble && type === 'text') {
          if (saveAble && (!item.valueDetail ||
            (!item.valueDetail.value || item.valueDetail.value.length === 0))) {
            showMessage && message.error(messages('setting.key1945', {
              arg1: indexSq,
              arg2: item.name
            })/*请输入条件{arg1}:{arg2}的条件值*/);
            saveAble = false;
            mess = messages('setting.key1945', {
              arg1: indexSq,
              arg2: item.name
            });
          }
        }
        if (saveAble && (type === 'long' || type === 'double' || type === 'date' || type === 'combo')) {
          if (!item.valueDetail) {
            showMessage && message.error(messages('setting.key1944', {
              arg1: indexSq,
              arg2: item.name
            })/*请选择条件{arg1}:{arg2}的条件值*/);
            saveAble = false;
            mess = messages('setting.key1944', {
              arg1: indexSq,
              arg2: item.name
            });
          } else {
            let list = item.valueDetail.list || [{}, {}];
            if (saveAble && !(list[0].value || list[0].value === 0) && !Number(list[0].symbol || 0) && !(list[1].value || list[1].value === 0) && !Number(list[1].symbol || 0)) {
              showMessage && message.error(messages('setting.key1944', {
                arg1: indexSq,
                arg2: item.name
              })/*请选择条件{arg1}:{arg2}的条件值*/);
              saveAble = false;
              mess = messages('setting.key1944', {
                arg1: indexSq,
                arg2: item.name
              });
            }
            list.map((listItem, listIndex) => {
              let listItemSymbol = Number(listItem.symbol || 0);
              if (saveAble && (listItem.value || listItem.value === 0) && !listItemSymbol) {
                showMessage && message.error(messages('setting.key1946', {
                  arg1: indexSq,
                  arg2: item.name,
                  arg3: listIndex + 1
                })/*请选择条件{arg1}:{arg2}的第{arg3}个条件符*/);
                saveAble = false;
                mess = messages('setting.key1946', {
                  arg1: indexSq,
                  arg2: item.name,
                  arg3: listIndex + 1
                })/*请选择条件{arg1}:{arg2}的第{arg3}个条件符*/;
              }
              if (saveAble && !(listItem.value || listItem.value === 0) && listItemSymbol) {
                showMessage && message.error(messages('setting.key1946', {
                  arg1: indexSq,
                  arg2: item.name,
                  arg3: listIndex + 1
                })/*请选择条件{arg1}:{arg2}的第{arg3}个条件符*/);
                saveAble = false;
                mess = messages('setting.key1946', {
                  arg1: indexSq,
                  arg2: item.name,
                  arg3: listIndex + 1
                })/*请选择条件{arg1}:{arg2}的第{arg3}个条件符*/;
              }
            });
            let leftValue = list[0].value;
            let rightValue = list[1].value;
            let leftSymbol = Number(list[0].symbol || 0);
            let rightSymbol = Number(list[1].symbol || 0);
            if (type === 'date') {
              if (new Date(leftValue).getTime() > new Date(rightValue).getTime()) {
                showMessage && message.error(messages('setting.key1947', {
                  arg1: indexSq,
                  arg2: item.name
                })/*请输入合法的条件{arg1}:{arg2}条件值，第一个时间不能比第二个时间晚*/);
                saveAble = false;
                mess = messages('setting.key1947', {
                  arg1: indexSq,
                  arg2: item.name
                })
              }
            } else {
              if (saveAble && leftValue && rightValue && (Number(leftValue) > Number(rightValue) || (Number(leftValue) === Number(rightValue)
                && (leftSymbol === 9001 || rightSymbol === 9003)))) {
                showMessage && message.error(messages('setting.key1948', {
                  arg1: indexSq,
                  arg2: item.name
                })/*请输入合法的条件{arg1}:{arg2}条件值，表达式不合法*/);
                saveAble = false;
                mess = messages('setting.key1948', {
                  arg1: indexSq,
                  arg2: item.name
                })
              }
            }
          }
        }
        if (saveAble && type === 'combo' && !item.showValue) {
          showMessage && message.error(messages('setting.key1949', {
            arg1: indexSq,
            arg2: item.name
          })/*请选择{arg1}{arg2}的条件值*/);
          saveAble = false;
          mess = messages('setting.key1949', {
            arg1: indexSq,
            arg2: item.name
          })
        }
        //复制异常情况处理
        if (item.warning) {
          showMessage && message.error(messages('setting.key2013')/*有当前审批流不支持的条件*/)
          //复制异常情况处理
          saveAble = false
          mess = messages('setting.key2013')/*有当前审批流不支持的条件*/
        }
      } else {
        if (saveAble && item.ruleConditionDTOList) {
          saveAble = (workflowUtil.handleVerify(item, node, showMessage)).isValid
        }
      }
    }
    return { isValid: saveAble, mess }
  },
  //给条件列表打上唯一标示
  setMarkOiDtoField(list){
    let copyList = list;
    (copyList['100'] || []).forEach(item => {item.markOID = workflowUtil.getRandomUUID()});
    (copyList['101'] || []).forEach(item => {item.markOID = workflowUtil.getRandomUUID()});
    (copyList['102'] || []).forEach(item => {item.markOID = workflowUtil.getRandomUUID()});
    (copyList['103'] || []).forEach(item => {item.markOID = workflowUtil.getRandomUUID()});
    (copyList['104'] || []).forEach(item => {item.markOID = workflowUtil.getRandomUUID()});
    (copyList['105'] || []).forEach(item => {item.markOID = workflowUtil.getRandomUUID()});
    (copyList['106'] || []).forEach(item => {item.markOID = workflowUtil.getRandomUUID()});
    (copyList['108'] || []).forEach(item => {item.markOID = workflowUtil.getRandomUUID()});
    (copyList['109'] || []).forEach(item => {item.markOID = workflowUtil.getRandomUUID()});
    (copyList['200'] || []).forEach(item => {item.markOID = workflowUtil.getRandomUUID()});
    (copyList['300'] || []).forEach(item => {item.markOID = workflowUtil.getRandomUUID()});
    (copyList['400'] || []).forEach(item => {item.markOID = workflowUtil.getRandomUUID()});
    return copyList
  },
  getInpRule(num, languageList){
    let inpRule = [];
    languageList.map(language => {
      inpRule.push({
        length: num,
        language: language.code.toLowerCase()
      });
    });
    return inpRule;
  }
}
